package nju.mscs.gui;
import com.cloudgarden.layout.AnchorConstraint;
import com.cloudgarden.layout.AnchorLayout;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JSeparator;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;

import nju.mscs.businesslogic.RG;
import nju.mscs.businesslogic.ReturnGoods;
import nju.mscs.businesslogic.SC;
import nju.mscs.businesslogic.SG;
import nju.mscs.businesslogic.SearchController;
import nju.mscs.businesslogic.SellGoods;
import nju.mscs.data.object.Gift;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class CashierService extends javax.swing.JFrame {
	private JTabbedPane jTabbedPane1;
	private JPanel jPanel1;
	private JPanel jPanel3;
	private JPanel jPanel2;
	
	//销售界面按钮声明
	private JLabel jLabel1sell;
	private JRadioButton jRadioButton1sell;
	private JLabel jLabel2sell;
	private JTextField jTextField6sell;
	private JButton jButton6sell;
	private JLabel jLabel1sell0sell;
	private JTextField jTextField5sell;
	private JLabel jLabel9sell;
	private JButton jButton8sell;
	private JButton jButton7sell;
	private JButton jButton3sell;
	private JButton jButton2sell;
	private JButton jButton1sell;
	private JTextField jTextField4sell;
	
	//退货界面按钮声明
	private JButton jButton5return;
	private JButton jButton4return;
	private JTextField jTextField3return;
	private JLabel jLabel5return;
	private JButton jButton3return;
	private JButton jButton2return;
	private JButton jButton1return;
	private JTable jTable2return;
	private JTextField jTextField2;
	private JLabel jLabel3;
	private JTextField jTextField1;
	private JLabel jLabel2;
	private JLabel jLabel1;
	private JTextField jTextField4return;
	private JTextField jTextField2return;
	private JLabel jLabel2return;
	private JTable jTable1return;
	private JTextField jTextField1return;
	private JLabel jLabel1return;
	private JLabel jLabel7sell;
	private JLabel jLabel10sell;
	private JTextField jTextField3sell;
	private JLabel jLabel5sell;
	private JTextField jTextField2sell;
	private JLabel jLabel3sell;
	private JTable jTable1sell;
	private JTextField jTextField1sell;
	private DefaultTableModel jTable1Modelsell;
	private DefaultTableModel jTable1Modelreturn;
	private DefaultTableModel jTable2Modelreturn;
	private JLabel jLabel14sell;
	private JTextField jTextField11sell;
	private JTextField jTextField10sell;
	private JLabel jLabel13sell;
	private JTextField jTextField9sell;
	private JLabel jLabel12sell;
	private JButton jButton6return;

	//vip查询界面按钮声明
	private JLabel jLabel1vip;
	private JButton jButton1vip;
	private JButton jButton2vip;
	private JLabel jLabel2vip;
	private JLabel jLabel4vip;
	private JButton jButton5vip;
	private JTextField jTextField6vip;
	private JLabel jLabel7vip;
	private JTextField jTextField5vip;
	private JLabel jLabel6vip;
	private JTextField jTextField2vip;
	private JLabel jLabel3vip;
	private JButton jButton4vip;
	private JButton jButton3vip;
	private JTextField jTextField4vip;
	private JLabel jLabel5vip;
	private JSeparator jSeparator1vip;
	private JTextField jTextField3vip;
	private JTextField jTextField1vip;
	
	private SearchController sc = new SC();
	private Gift gift;
	private SellGoods sg = new SG();
    private ReturnGoods rg = new  RG();
	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				CashierService inst = new CashierService();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public CashierService() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			//getContentPane().setLayout(null);
			this.setUndecorated(true);
			{
				jTabbedPane1 = new JTabbedPane();
				getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
				jTabbedPane1.setPreferredSize(new java.awt.Dimension(810, 451));
				jTabbedPane1.setFont(new java.awt.Font("微软雅黑",0,28));

				{
					jPanel1 = new JPanel();
					jTabbedPane1.addTab("销售处理", null, jPanel1, null);
					jPanel1.setLayout(null);
					jPanel1.setPreferredSize(new java.awt.Dimension(896, 433));
					jPanel1.setFont(new java.awt.Font("微软雅黑",0,26));

					{
						jLabel1sell = new JLabel();
						//getContentPane().add(jLabel1sell, new AnchorConstraint(43, 201, 105, 34, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jLabel1sell.setText("\u9500\u552e\u5546\u54c1");
						jLabel1sell.setFont(new java.awt.Font("微软雅黑",1,28));
						jLabel1sell.setBounds(24, 12, 138, 38);
						jPanel1.add(jLabel1sell);
					}
					{
						jRadioButton1sell = new JRadioButton();
						//getContentPane().add(jRadioButton1sell, new AnchorConstraint(133, 142, 183, 34, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jRadioButton1sell.setText("VIP\u987e\u5ba2");
						jRadioButton1sell.setBounds(24, 50, 138, 35);
						jPanel1.add(jRadioButton1sell);
						jRadioButton1sell.setFont(new java.awt.Font("微软雅黑",0,26));
					}
					{
						jLabel2sell = new JLabel();
						//getContentPane().add(jLabel2sell, new AnchorConstraint(138, 265, 181, 183, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jLabel2sell.setText("\u5ba2\u6237\u7f16\u53f7");
						jLabel2sell.setBounds(231, 52, 130, 31);
						jPanel1.add(jLabel2sell);
						jLabel2sell.setFont(new java.awt.Font("微软雅黑",0,26));
					}
					{
						jTextField1sell = new JTextField();
						//getContentPane().add(jTextField1sell, new AnchorConstraint(131, 417, 188, 273, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jTextField1sell.setBounds(347, 51, 116, 33);
						jPanel1.add(jTextField1sell);
						jTextField1sell.setFont(new java.awt.Font("微软雅黑",0,28));
						jTextField1sell.addKeyListener(new KeyAdapter() {
							public void keyPressed(KeyEvent evt) {
								jTextField1sellKeyPressed(evt);
							}
						});
					}
					{
						jTable1Modelsell = 
							new DefaultTableModel(
									new String[][]{ },
									new String[] {"商品标识","描述","数量","价格/元","价格优惠","礼品赠送","商品总价/元"});						
						jTable1sell = new JTable(jTable1Modelsell);
						jTable1sell.setFont(new java.awt.Font("微软雅黑",0,24));
						//getContentPane().add(jTable1sell, new AnchorConstraint(250, 886, 733, 42, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						//jTable1.setModel(jTable1Model);
						jTable1sell.setBounds(24, 105, 632, 204);
						jTable1sell.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
						jTable1sell.setSelectionBackground(Color.BLACK);
						jTable1sell.setSelectionForeground(Color.WHITE);
						jTable1sell.getTableHeader().setFont(new java.awt.Font("微软雅黑",0,28));
						jTable1sell.setFont(new java.awt.Font("微软雅黑",0,28));
						jTable1sell.setRowHeight(30);
						JScrollPane scrollpanesell = new JScrollPane(jTable1sell);
						//getContentPane().add(scrollpanesell);
						scrollpanesell.setBounds(24, 165, 1187, 199);
						jPanel1.add(scrollpanesell);
						scrollpanesell.setFont(new java.awt.Font("微软雅黑",0,24));
					}
					{
						jLabel3sell = new JLabel();
						//getContentPane().add(jLabel3sell, new AnchorConstraint(778, 183, 813, 42, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jLabel3sell.setText("\u5546\u54c1\u603b\u4ef7/\u5143");
						jLabel3sell.setBounds(427, 380, 178, 41);
						jPanel1.add(jLabel3sell);
						jLabel3sell.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField2sell = new JTextField();
						//getContentPane().add(jTextField2sell, new AnchorConstraint(768, 337, 821, 178, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jTextField2sell.setBounds(617, 376, 162, 45);
						jPanel1.add(jTextField2sell);
						jTextField2sell.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jLabel5sell = new JLabel();
						//getContentPane().add(jLabel5sell, new AnchorConstraint(778, 474, 813, 390, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jLabel5sell.setText("\u5b9e\u9645\u6536\u53d6/\u5143");
						jLabel5sell.setBounds(427, 522, 179, 39);
						jPanel1.add(jLabel5sell);
						jLabel5sell.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField3sell = new JTextField();
						//getContentPane().add(jTextField3sell, new AnchorConstraint(768, 606, 821, 474, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jTextField3sell.setBounds(618, 521, 162, 46);
						jPanel1.add(jTextField3sell);
						jTextField3sell.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jLabel7sell = new JLabel();
						//getContentPane().add(jLabel7sell, new AnchorConstraint(778, 719, 813, 666, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jLabel7sell.setText("\u627e\u8fd8\u96f6\u94b1/\u5143");
						jLabel7sell.setBounds(822, 523, 161, 37);
						jPanel1.add(jLabel7sell);
						jLabel7sell.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField4sell = new JTextField();
						//getContentPane().add(jTextField4sell, new AnchorConstraint(768, 857, 821, 716, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jTextField4sell.setBounds(1000, 518, 163, 47);
						jPanel1.add(jTextField4sell);
						jTextField4sell.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jButton1sell = new JButton();
						//getContentPane().add(jButton1sell, new AnchorConstraint(866, 165, 918, 42, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jButton1sell.setText("\u6e05\u7a7a");
						jButton1sell.setBounds(168, 612, 131, 47);
						jPanel1.add(jButton1sell);
						jButton1sell.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton1sell.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton1sellActionPerformed(evt);
							}
						});
					}
					{
						jButton2sell = new JButton();
						//getContentPane().add(jButton2sell, new AnchorConstraint(866, 766, 918, 555, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jButton2sell.setText("\u6253\u5370\u51ed\u6761\u5b8c\u6210\u4ea4\u6613");
						jButton2sell.setBounds(707, 612, 300, 47);
						jPanel1.add(jButton2sell);
						jButton2sell.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton2sell.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton2sellActionPerformed(evt);
							}
						});
					}
					{
						jButton3sell = new JButton();
						//getContentPane().add(jButton3sell, new AnchorConstraint(866, 915, 918, 816, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						jButton3sell.setText("\u8fd4\u56de");
						jButton3sell.setBounds(1066, 612, 111, 47);
						jPanel1.add(jButton3sell);
						jButton3sell.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton3sell.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton3sellActionPerformed(evt);
							}
						});
					}
					{
						jLabel9sell = new JLabel();
						//getContentPane().add(jLabel9sell);
						jLabel9sell.setText("\u8bf7\u8f93\u5165\u8d2d\u4e70\u7684\u5546\u54c1\u7684\u4fe1\u606f\uff1a \u5546\u54c1\u6807\u8bc6");
						jLabel9sell.setBounds(30, 109, 431, 32);
						jPanel1.add(jLabel9sell);
						jLabel9sell.setFont(new java.awt.Font("微软雅黑",0,24));
					}
					{
						jTextField5sell = new JTextField();
						//getContentPane().add(jTextField5sell);
						jTextField5sell.setBounds(438, 106, 116, 38);
						jPanel1.add(jTextField5sell);
						jTextField5sell.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jLabel10sell = new JLabel();
						//getContentPane().add(jLabel10sell);
						jLabel10sell.setText("\u6570\u91cf");
						jLabel10sell.setBounds(567, 106, 79, 32);
						jPanel1.add(jLabel10sell );
						jLabel10sell.setFont(new java.awt.Font("微软雅黑",0,26));
					}
					{
						jTextField6sell = new JTextField();
						//getContentPane().add(jTextField6sell);
						jTextField6sell.setBounds(642, 103, 124, 38);
						jPanel1.add(jTextField6sell);
						jTextField6sell.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jButton6sell = new JButton();
						//getContentPane().add(jButton6sell);
						jButton6sell.setText("\u6dfb\u52a0");
						jButton6sell.setBounds(836, 96, 134, 52);
						jPanel1.add(jButton6sell);
						jButton6sell.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton6sell.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton6sellActionPerformed(evt);
							}
						});
					}
					{
						jButton7sell = new JButton();
						//getContentPane().add(jButton7sell);
						jButton7sell.setText("\u603b\u4ef7");
						jButton7sell.setBounds(1027, 96, 134, 52);
						jPanel1.add(jButton7sell);
						jButton7sell.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton7sell.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton7sellActionPerformed(evt);
							}
						});
					}
					{
						jButton8sell = new JButton();
						//getContentPane().add(jButton8sell);
						jButton8sell.setText("\u7ed3\u7b97");
						jButton8sell.setBounds(431, 612, 123, 47);
						jPanel1.add(jButton8sell);
						jButton8sell.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton8sell.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton8sellActionPerformed(evt);
							}
						});
					}
					{
						jLabel2 = new JLabel();
						jPanel1.add(jLabel2);
						jLabel2.setText("\u4f18\u60e0\u6298\u6263");
						jLabel2.setBounds(441, 445, 144, 53);
						jLabel2.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField1 = new JTextField();
						jPanel1.add(jTextField1);
						jTextField1.setBounds(618, 449, 162, 44);
						jTextField1.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jLabel3 = new JLabel();
						jPanel1.add(jLabel3);
						jLabel3.setText("\u652f\u4ed8\u603b\u4ef7/\u5143");
						jLabel3.setBounds(822, 452, 172, 38);
						jLabel3.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField2 = new JTextField();
						jTextField2.setFont(new java.awt.Font("微软雅黑",0,28));
						jPanel1.add(jTextField2);
						jTextField2.setBounds(1000, 449, 161, 44);
					}
					{
						jLabel12sell = new JLabel();
						jPanel1.add(jLabel12sell);
						jLabel12sell.setText("\u79ef\u5206\u989d\u5ea6");
						jLabel12sell.setBounds(504, 53, 128, 29);
						jLabel12sell.setFont(new java.awt.Font("微软雅黑",0,26));
					}
					{
						jTextField9sell = new JTextField();
						jTextField9sell.setFont(new java.awt.Font("微软雅黑",0,28));
						jPanel1.add(jTextField9sell);
						jTextField9sell.setBounds(638, 52, 130, 39);
					}
					{
						jLabel13sell = new JLabel();
						jPanel1.add(jLabel13sell);
						jLabel13sell.setText("\u79ef\u5206\u4f7f\u7528");
						jLabel13sell.setBounds(59, 455, 145, 32);
						jLabel13sell.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField10sell = new JTextField();
						jTextField10sell.setFont(new java.awt.Font("微软雅黑",0,28));
						jPanel1.add(jTextField10sell);
						jTextField10sell.setBounds(195, 449, 174, 44);
						jTextField10sell.addKeyListener(new KeyAdapter() {
							public void keyPressed(KeyEvent evt) {
								jTextField10sellKeyPressed(evt);
							}
						});
					}
					{
						jLabel14sell = new JLabel();
						jPanel1.add(jLabel14sell);
						jLabel14sell.setText("\u79ef\u5206\u4f59\u989d");
						jLabel14sell.setBounds(60, 522, 122, 39);
						jLabel14sell.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField11sell = new JTextField();
						jTextField11sell.setFont(new java.awt.Font("微软雅黑",0,28));
						jPanel1.add(jTextField11sell);
						jTextField11sell.setBounds(194, 522, 174, 45);
					}
				}
				{
					jPanel2 = new JPanel();
					jTabbedPane1.addTab("退货处理", null, jPanel2, null);
					jPanel2.setLayout(null);
					{
						jLabel1return = new JLabel();
						jPanel2.add(jLabel1return);
						jLabel1return.setText("\u8d26\u5355\u7f16\u53f7");
						jLabel1return.setBounds(67, 33, 135, 37);
						jLabel1return.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField1return = new JTextField();
						jTextField1return.setFont(new java.awt.Font("微软雅黑",0,28));
						jPanel2.add(jTextField1return);
						jTextField1return.setBounds(196, 30, 147, 40);
					}
					{
						jTable1Modelreturn = 
							new DefaultTableModel(
									new String[][]{ },
									new String[] {"商品编号","商品名称","交易数量","价格/元","已退/未退"});
						jTable1return = new JTable(jTable1Modelreturn);
						//getContentPane().add(jTable1return, new AnchorConstraint(250, 886, 733, 42, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						//jTable1.setModel(jTable1Model);
						jTable1return.setBounds(24, 105, 632, 204);
						jTable1return.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
						jTable1return.setSelectionBackground(Color.BLACK);
						jTable1return.setSelectionForeground(Color.WHITE);
						jTable1return.getTableHeader().setFont(new java.awt.Font("微软雅黑",0,28));
						jTable1return.setFont(new java.awt.Font("微软雅黑",0,28));
						jTable1return.setRowHeight(30);
						JScrollPane scrollpane1return = new JScrollPane(jTable1return);
						//getContentPane().add(scrollpane1return);
						scrollpane1return.setBounds(46, 82, 1199, 156);
						jPanel2.add(scrollpane1return);
					}
					{
						jLabel2return = new JLabel();
						jPanel2.add(jLabel2return);
						jLabel2return.setText("\u5546\u54c1\u7f16\u53f7");
						jLabel2return.setBounds(52, 264, 144, 38);
						jLabel2return.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField2return = new JTextField();
						jTextField2return.setFont(new java.awt.Font("微软雅黑",0,28));
						jPanel2.add(jTextField2return);
						jTextField2return.setBounds(180, 267, 196, 38);
					}
					{
						jTable2Modelreturn = 
							new DefaultTableModel(
									new String[][]{ },
									new String[] {"商品编号","商品名称","单价/元"});
						jTable2return = new JTable(jTable2Modelreturn){
							public boolean isCellEditable(int row, int column) 
							{          if(column==0){
								return false;}
							return true;
							}//表格不允许被编辑
						};				
						//getContentPane().add(jTable2return, new AnchorConstraint(250, 886, 733, 42, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL, AnchorConstraint.ANCHOR_REL));
						//jTable1.setModel(jTable1Model);
						jTable2return.setBounds(24, 105, 632, 204);
						jTable2return.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
						jTable2return.setSelectionBackground(Color.BLACK);
						jTable2return.setSelectionForeground(Color.WHITE);
						jTable2return.getTableHeader().setFont(new java.awt.Font("微软雅黑",0,28));
						jTable2return.setFont(new java.awt.Font("微软雅黑",0,28));
						jTable2return.setRowHeight(30);
						JScrollPane scrollpane2return = new JScrollPane(jTable2return);
						//getContentPane().add(scrollpane2return);
						scrollpane2return.setBounds(46, 317, 1199, 188);
						jPanel2.add(scrollpane2return);
					}
					{
						jButton1return = new JButton();
						jPanel2.add(jButton1return);
						jButton1return.setText("\u9000\u8d27");
						jButton1return.setBounds(809, 571, 140, 51);
						jButton1return.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton1return.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton1returnActionPerformed(evt);
							}
						});
					}
					{
						jButton2return = new JButton();
						jPanel2.add(jButton2return);
						jButton2return.setText("\u8fd4\u56de");
						jButton2return.setBounds(1013, 566, 135, 61);
						jButton2return.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton2return.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton2returnActionPerformed(evt);
							}
						});
					}
					{
						jButton3return = new JButton();
						jPanel2.add(jButton3return);
						jButton3return.setText("\u6e05\u7a7a");
						jButton3return.setBounds(61, 576, 118, 41);
						jButton3return.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton3return.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton3returnActionPerformed(evt);
							}
						});
					}
					{
						jLabel5return = new JLabel();
						jPanel2.add(jLabel5return);
						jLabel5return.setText("\u4ea4\u6613\u65e5\u671f");
						jLabel5return.setBounds(712, 36, 140, 36);
						jLabel5return.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField3return = new JTextField();
						jTextField3return.setFont(new java.awt.Font("微软雅黑",0,28));
						jPanel2.add(jTextField3return);
						jTextField3return.setBounds(836, 39, 192, 33);
					}
					{
						jButton4return = new JButton();
						jPanel2.add(jButton4return);
						jButton4return.setText("\u786e\u5b9a");
						jButton4return.setBounds(370, 30, 120, 40);
						jButton4return.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton4return.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton4returnActionPerformed(evt);
							}
						});
					}
					{
						jButton5return = new JButton();
						jPanel2.add(jButton5return);
						jButton5return.setText("\u6dfb\u52a0");
						jButton5return.setBounds(422, 261, 140, 44);
						jButton5return.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton5return.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton5returnActionPerformed(evt);
							}
						});
					}
					{
						jTextField4return = new JTextField();
						jTextField4return.setFont(new java.awt.Font("微软雅黑",0,28));
						jPanel2.add(jTextField4return);
						jTextField4return.setBounds(362, 571, 174, 51);
					}
					{
						jLabel1 = new JLabel();
						jPanel2.add(jLabel1);
						jLabel1.setText("\u5143");
						jLabel1.setBounds(548, 566, 63, 56);
						jLabel1.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jButton6return = new JButton();
						jPanel2.add(jButton6return);
						jButton6return.setText("\u7ed3\u7b97");
						jButton6return.setBounds(220, 576, 123, 41);
						jButton6return.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton6return.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton6returnActionPerformed(evt);
							}
						});
					}
					
				}
				{
					jPanel3 = new JPanel();
					jTabbedPane1.addTab("VIP查询", null, jPanel3, null);
					jPanel3.setLayout(null);
					
					{
						jLabel1vip = new JLabel();
						//getContentPane().add(jLabel1vip);
						jLabel1vip.setText("VIP\u67e5\u8be2");
						jLabel1vip.setBounds(39, 18, 169, 38);
						jLabel1vip.setFont(new java.awt.Font("微软雅黑",1,28));
						jPanel3.add(jLabel1vip);
					}
					
					{
						jLabel2vip = new JLabel();
						//getContentPane().add(jLabel2vip);
						jLabel2vip.setText("\u5ba2\u6237\u7f16\u53f7");
						jLabel2vip.setBounds(39, 91, 139, 34);
						jPanel3.add(jLabel2vip);
						jLabel2vip.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField1vip = new JTextField();
						jTextField1vip.setFont(new java.awt.Font("微软雅黑",0,28));
						//getContentPane().add(jTextField1vip);
						jTextField1vip.setBounds(162, 91, 336, 41);
						jPanel3.add(jTextField1vip);
					}
					{
						jLabel4vip = new JLabel();
						//getContentPane().add(jLabel4vip);
						jLabel4vip.setText("\u8054\u7cfb\u65b9\u5f0f");
						jLabel4vip.setBounds(524, 94, 126, 28);
						jPanel3.add(jLabel4vip);
						jLabel4vip.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField3vip = new JTextField();
						jTextField3vip.setFont(new java.awt.Font("微软雅黑",0,28));
						//getContentPane().add(jTextField3vip);
						jTextField3vip.setBounds(656, 91, 421, 41);
						jPanel3.add(jTextField3vip);
					}
					{
						jSeparator1vip = new JSeparator();
						//getContentPane().add(jSeparator1vip);
						jSeparator1vip.setBounds(39, 153, 1109, 10);
						jPanel3.add(jSeparator1vip);
					}
					{
						jLabel5vip = new JLabel();
						//getContentPane().add(jLabel5vip);
						jLabel5vip.setText("\u5ba2\u6237\u79ef\u5206");
						jLabel5vip.setBounds(60, 476, 156, 29);
						jPanel3.add(jLabel5vip);
						jLabel5vip.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField4vip = new JTextField();
						jTextField4vip.setFont(new java.awt.Font("微软雅黑",0,28));
						//getContentPane().add(jTextField4vip);
						jTextField4vip.setBounds(234, 207, 671, 53);
						jPanel3.add(jTextField4vip);
					}
					{
						jButton3vip = new JButton();
						//getContentPane().add(jButton3vip);
						jButton3vip.setText("\u67e5\u8be2");
						jButton3vip.setBounds(685, 550, 176, 71);
						jPanel3.add(jButton3vip);
						jButton3vip.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton3vip.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton3vipActionPerformed(evt);
							}
						});
					}
					{
						jButton4vip = new JButton();
						//getContentPane().add(jButton4vip);
						jButton4vip.setText("\u8fd4\u56de");
						jButton4vip.setBounds(1004, 550, 177, 71);
						jPanel3.add(jButton4vip);
						jButton4vip.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton4vip.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton4vipActionPerformed(evt);
							}
						});
					}
					{
						jLabel3vip = new JLabel();
						//getContentPane().add(jLabel3vip);
						jLabel3vip.setText("\u5ba2\u6237\u59d3\u540d");
						jLabel3vip.setBounds(60, 217, 156, 32);
						jPanel3.add(jLabel3vip);
						jLabel3vip.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField2vip = new JTextField();
						jTextField2vip.setFont(new java.awt.Font("微软雅黑",0,28));
						//getContentPane().add(jTextField2vip);
						jTextField2vip.setBounds(234, 294, 671, 50);
						jPanel3.add(jTextField2vip);
					}
					{
						jLabel6vip = new JLabel();
						//getContentPane().add(jLabel6vip);
						jLabel6vip.setText("\u5ba2\u6237\u6027\u522b");
						jLabel6vip.setBounds(60, 303, 148, 32);
						jPanel3.add(jLabel6vip);
						jLabel6vip.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField5vip = new JTextField();
						jTextField5vip.setFont(new java.awt.Font("微软雅黑",0,28));
						//getContentPane().add(jTextField5vip);
						jTextField5vip.setBounds(234, 377, 671, 49);
						jPanel3.add(jTextField5vip);
					}
					{
						jLabel7vip = new JLabel();
						//getContentPane().add(jLabel7vip);
						jLabel7vip.setText("\u5ba2\u6237\u751f\u65e5");
						jLabel7vip.setBounds(60, 390, 148, 26);
						jPanel3.add(jLabel7vip);
						jLabel7vip.setFont(new java.awt.Font("微软雅黑",0,28));
					}
					{
						jTextField6vip = new JTextField();
						jTextField6vip.setFont(new java.awt.Font("微软雅黑",0,28));
						//getContentPane().add(jTextField6vip);
						jTextField6vip.setBounds(234, 464, 671, 48);
						jPanel3.add(jTextField6vip);
					}
					{
						jButton5vip = new JButton();
						//getContentPane().add(jButton5vip, BorderLayout.CENTER);
						jButton5vip.setText("\u6e05\u7a7a");
						jButton5vip.setBounds(92, 550, 185, 71);
						jPanel3.add(jButton5vip);
						jButton5vip.setFont(new java.awt.Font("微软雅黑",0,28));
						jButton5vip.addActionListener(new ActionListener() {
							public void actionPerformed(ActionEvent evt) {
								jButton5vipActionPerformed(evt);
							}
						});
					}
					
				}
				
			}
			pack();
			this.setSize(1278, 762);
			getGraphicsConfiguration().getDevice().setFullScreenWindow(this);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	private void jButton3sellActionPerformed(ActionEvent evt) {
		//System.out.println("jButton3.actionPerformed, event="+evt);
		login1 l1 = new login1();
		l1.main(null);
		this.dispose();
	}//返回按钮事件响应
	
	
	
	private void jButton2sellActionPerformed(ActionEvent evt) {
		//System.out.println("jButton2.actionPerformed, event="+evt);
		sg.store();
	}//打印凭条保存按钮事件响应
	
	private void jButton6sellActionPerformed(ActionEvent evt) {
		//System.out.println("jButton6.actionPerformed, event="+evt);
		int number = Integer.parseInt(jTextField6sell.getText());
		String[] rowvalues =sg.addGoods(jTextField5sell.getText(),number);
		if(rowvalues==null){
			JOptionPane.showMessageDialog(this,"处理失败！ ");
			return;
		}
		jTable1Modelsell.addRow(rowvalues);				
	}//添加新商品按钮事件响应
	
	private void jButton7sellActionPerformed(ActionEvent evt) {
		//System.out.println("jButton7.actionPerformed, event="+evt);
		int rowcount = jTable1sell.getRowCount();
		double totalprice[] = new double[3];
        /*int usepoint = Integer.parseInt(jTextField10sell.getText());
        if((usepoint<50)||(usepoint%50!=0)){
        	JOptionPane.showMessageDialog(this,"积分使用不合法！ ");
			return;
        }*/
		
		try{
		totalprice = sg.calculate(0);
		jTextField2sell.setText(totalprice[0]+"");
		jTextField1.setText(totalprice[1]+"");
		jTextField2.setText(totalprice[2]+"");
		{
			String[] s = sg.getGift();
			int len = s.length;
			String gift=null;
			for(int o=0;o<len;o++){
				gift+=s[o]+" ";
			}
			JOptionPane.showMessageDialog(this,"赠品为："+ gift+" " );
			return;
		}
		}catch(Exception e){
		}
	}//总价按钮事件响应
	
	private void jButton8sellActionPerformed(ActionEvent evt) {
		//System.out.println("jButton8.actionPerformed, event="+evt);
		double p0 =  Double.parseDouble(jTextField2.getText());
		double p1 =  Double.parseDouble(jTextField3sell.getText());
		if(p1<p0){
			JOptionPane.showMessageDialog(this,"付款有误！");
			return;
		}
		double p2 = sg.change(p1);
		if(!jTextField10sell.getText().equals("")){
		jTextField11sell.setText((Integer.parseInt(jTextField9sell.getText())-Integer.parseInt(jTextField10sell.getText()))+"");}
		jTextField4sell.setText(p2+" ");
	}//结算按钮事件响应
	
	private void jButton1sellActionPerformed(ActionEvent evt) {
		//System.out.println("jButton1.actionPerformed, event="+evt);
		
		CashierService.main(null);
		this.dispose();
	}//清空按钮事件响应
	
	
	
	private void jButton4returnActionPerformed(ActionEvent evt) {
		//System.out.println("jButton4return.actionPerformed, event="+evt);
		String billid = jTextField1return.getText();
		String[][] billinfo = rg.searchBill(billid);
		if(billinfo.equals(null)){
			JOptionPane.showMessageDialog(this,"查无此交易记录！");
			return;
		}
		jTextField3return.setText(billinfo[0][0]);
		int len = billinfo.length;
		for(int i=0;i<len-1;i++){
			jTable1Modelreturn.addRow(billinfo[i]);
		}
		jTextField1return.setText(null);
		
	}//退货-添加账单按钮事件
	
	private void jButton5returnActionPerformed(ActionEvent evt) {
		//System.out.println("jButton5return.actionPerformed, event="+evt);
		String goodsid = jTextField2return.getText();
		String[] goodsinfo = rg.addGoods(goodsid);
		if(goodsinfo.equals(null)){
			JOptionPane.showMessageDialog(this,"查无此商品信息！");
			return;
		}
			jTable1Modelreturn.addRow(goodsinfo);
		jTextField2return.setText(null);
	}//退货-添加商品按钮事件
	
	private void jButton3returnActionPerformed(ActionEvent evt) {
		//System.out.println("jButton3return.actionPerformed, event="+evt);
		String delgoodsid = jTable2return.getValueAt(jTable2return.getSelectedRow(), 0).toString();
		Boolean result  = rg.deleteGoods(delgoodsid);
		if(result){
			JOptionPane.showMessageDialog(this,"取消退此商品成功！");
			return;
		}
		else{
			JOptionPane.showMessageDialog(this,"取消退此商品失败！");
			return;
		}		
	}//退货-清空按钮事件
	
	
	private void jButton1returnActionPerformed(ActionEvent evt) {
		//System.out.println("jButton1return.actionPerformed, event="+evt);
		Boolean returnresult = rg.returning();
		jTextField4return.setText(rg.returnMoney()+"");
		if(returnresult){
			JOptionPane.showMessageDialog(this,"退货成功！");
			return;
		}
		else{
			JOptionPane.showMessageDialog(this,"退货失败！");
			return;
		}	
	}//退货-退货按钮事件
	
	private void jButton2returnActionPerformed(ActionEvent evt) {
		//System.out.println("jButton2return.actionPerformed, event="+evt);
		login1 l1 = new login1();
		l1.main(null);
		this.dispose();
	}//退货-返回按钮事件

	private void jButton3vipActionPerformed(ActionEvent evt) {
		//System.out.println("jButton3.actionPerformed, event="+evt);
		String code = jTextField1vip.getText();
		String phoneno=jTextField3vip.getText();

		//String[] result = Vip.getInfo(code,name,phoneno);
//		jTextField1.setText(result[0]);
//		jTextField2.setText(result[1]);
//		jTextField3.setText(result[2]);
//		jTextField4.setText(result[3]);
//		jTextArea1.setText(result[4]);
//		jTextArea2.setText(result[5]);

		String[] result = sc.searchVIP(code,phoneno);
		if(result.equals(null)||result.equals("")){
			JOptionPane.showMessageDialog(this,"查无此人！");
			return;
		}
		jTextField1vip.setText(result[0]);//id
		jTextField3vip.setText(result[1]);//phone
		jTextField4vip.setText(result[2]);//name
		jTextField2vip.setText(result[3]);//sex
		jTextField5vip.setText(result[4]);//birth
		jTextField6vip.setText(result[5]);//point

	}//查询按钮事件响应
	
	private void jButton4vipActionPerformed(ActionEvent evt) {
		//System.out.println("jButton4.actionPerformed, event="+evt);
		login1 l1 = new login1();
		l1.main(null);
		this.dispose();
	}//返回按钮事件响应
	
	private void jButton5vipActionPerformed(ActionEvent evt) {
		//System.out.println("jButton5.actionPerformed, event="+evt);
		jTextField1vip.setText(null);//id
		jTextField3vip.setText(null);//phone
		jTextField4vip.setText(null);//name
		jTextField2vip.setText(null);//sex
		jTextField5vip.setText(null);//birth
		jTextField6vip.setText(null);//point
	}//清空按钮事件响应
	
	private void jButton6returnActionPerformed(ActionEvent evt) {
		//System.out.println("jButton6return.actionPerformed, event="+evt);
		jTextField4return.setText(rg.returnMoney()+"");
	}
	
	private void jTextField1sellKeyPressed(KeyEvent evt) {
		//System.out.println("jTextField1sell.keyPressed, event="+evt);
		if(evt.getKeyCode()==KeyEvent.VK_ENTER){
		if(jRadioButton1sell.isSelected()){
			String vipid = jTextField1sell.getText();
			int point = sg.useVIP(vipid);
			if(point == -1){
				JOptionPane.showMessageDialog(this,"不存在此vip用户！");
				return;
			}
			jTextField9sell.setText(point+"");}
		}
	}//客户编号文本框事件响应
	
	private void jTextField10sellKeyPressed(KeyEvent evt) {
		//System.out.println("jTextField10sell.keyPressed, event="+evt);
		if(evt.getKeyCode()==KeyEvent.VK_ENTER){
		double totalprice1[] = new double[3];
        int usepoint = Integer.parseInt(jTextField10sell.getText());
        if((usepoint<50)||(usepoint%50!=0)||(usepoint>Integer.parseInt(jTextField9sell.getText()))){
        	JOptionPane.showMessageDialog(this,"积分使用不合法！ ");
			return;
        }
		
		try{
		totalprice1 = sg.calculate(usepoint);
		jTextField2sell.setText(totalprice1[0]+"");
		jTextField1.setText(totalprice1[1]+"");
		jTextField2.setText(totalprice1[2]+"");
		{
			String[] s = sg.getGift();
			JOptionPane.showMessageDialog(this,"赠品为："+ s+" " );
			return;
		}
		}catch(Exception e){
		}}
	}//积分使用按键事件
}
